package com.ase.springsecurity.entity.mongodb;

import com.ase.springsecurity.entity.mongodb.util.AutoInc;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;

/**
 * @author gyhstart
 * @create 2020/12/27 - 0:43
 **/

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true) //链式调用
@Document(collection = "user") //指定集合
public class UserMongoDB implements Serializable {

    private static final long serialVersionUID = -8288372263395673353L;
    /**
     * 使用 @MongoID 能更清晰的指定 _id 主键
     */
    @Id
    @AutoInc
    @Field("id")
    private int id;
    @Field("name")
    private String name;
    @Field("age")
    private int age;
}